package weapons;
import iterfaces.Ships;

import javax.print.DocFlavor.CHAR_ARRAY;

import controllers.Map;
import controllers.Point;
import controllers.State;



/**
 * @author 508461
 * @version 1.0
 * @created 24-mei-2012 12:47:47
 */
public class ChaffLauncher extends Weaponsystem {
	
	private Ships 			ship;
	private static final int MAGAZINE_SIZE 						= 4;
	private static final int MAX_HEALTHPOINTS_BEFORE_SHUTDOWN	= 0; //in %
	private static final int RELOAD_TIME 						= 30; //sec	
	private static final int MAGAZINE_AMOUNT 					= 1;
	private static final int FIRE_RATE 							= 1; //= 1 per keer
	private int remainingBullets;
	

	public static void main(String[] args){
		// Test de verbonden classes.
		new ChaffLauncher();
	}
	
	public ChaffLauncher(){
		super(State.Online , MAGAZINE_SIZE, MAX_HEALTHPOINTS_BEFORE_SHUTDOWN, RELOAD_TIME, MAGAZINE_AMOUNT, FIRE_RATE);
		System.out.println("Instance " + this.getClass() + " created.");
	}
	
	public ChaffLauncher(Ships ship){	
		super(State.Online , MAGAZINE_SIZE, MAX_HEALTHPOINTS_BEFORE_SHUTDOWN, RELOAD_TIME, MAGAZINE_AMOUNT, FIRE_RATE);
		this.ship= ship;		
		System.out.println("Instance " + this.getClass() + " created.");
	}
	
	
	public int getRemainingBullets(){
		return this.remainingBullets;
	}
	
	public void setRemainingBullets(int remainingBullets)
	{
		this.remainingBullets = remainingBullets;
	}
	
	public void shoot(Point point, Point shoot){
		Bullet chaff = new Chaff(this.ship.getPosition());
		//chaff.addWaypoint(chaff, point);
		chaff.setDrawWaypoints(false);
		Map.getMap().addDrawAbleObject(chaff);
		//Map.getMap().dObjects.get(Map.getMap().dObjects.size()-1).addWaypoint(Map.getMap().dObjects.get(Map.getMap().dObjects.size()-1), shoot);
		chaff.addWaypoint(chaff, shoot);
	}

	public void finalize() throws Throwable {
		super.finalize();
	}

}